package shuangzu.top.zzurla.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import shuangzu.top.zzurla.R;
import shuangzu.top.zzurla.entities.entity_bulletin;

import java.util.Collections;
import java.util.List;

public class bulletin_adapter extends ArrayAdapter {
    private TextView txt_title;
    private TextView txt_date_writer;
    private TextView txt_tables;
    private TextView txt_value;
    private final int resourceId;

    public bulletin_adapter(Context context, int textViewResourceId, List<entity_bulletin> object)
    {

        super(context,textViewResourceId,object);
        resourceId=textViewResourceId;
    }

    @Override
    public View getView (int position, View convertView, ViewGroup parent){
        entity_bulletin notices=(entity_bulletin)getItem(position);
        View view= LayoutInflater.from(getContext()).inflate(resourceId,null);
        txt_title =(TextView)view.findViewById(R.id.view_title);
        txt_date_writer=(TextView)view.findViewById(R.id.view_date_writer);
        txt_value=(TextView)view.findViewById(R.id.txtvalue);
        txt_tables=(TextView)view.findViewById(R.id.view_tags);

        txt_title.setText(notices.getBull_title());
        txt_date_writer.setText(notices.getBull_publisher_date()+"/"+notices.getBull_publisher_id());
        txt_tables.setText("标签：" + notices.getBull_tags());
        txt_value.setText(notices.getBull_markdown_path());
        if(notices.getBull_img()!="" || notices.getBull_img()!="null")
        {
            //说明有图片
        }

        return view;
    }

}
